import Vue from "vue"
import Vuex from "vuex"
import state from "./state"
import mutations from "./mutations"
import * as getters from "./getters" 
import * as actions from "./actions"

Vue.use(Vuex)
import createLogger from 'vuex/dist/logger'; //这是一个vuex的小插件， 可以提示我们state的值在改变前后的变化

const debug = process.env.NODE_ENV !== 'production'; //开启调试工具，在非生成编译的时候就启用
const store = new Vuex.Store({
    state,
    mutations,
    getters,
    actions,
    strict: debug, //开启 debug选项
    plugins: debug ? [createLogger()] : []
})

export default store